<template>
	<view class="goods-container">
		<view class="goods-card radius20 mb20" v-for="(item,index) in dataArray" :key="index">
			<view class="goods-card-info" @click="nologinJump('/subpage/housekeeping/detail?id=' + item.id)">
				<view class="card-image">
					<image :src="api_host + item.icon" mode="aspectFill"></image>
				</view>
				<view class="card-content">
					<view class="card-title c343 f28 bold mb10">{{item.title}}</view>
					<view class="card-rating f24 flex align-center c999 mb10">
						<u-icon name="star-fill" color="#FFDE6D" size="14"></u-icon>
						<text class="ml5">{{item.mark.toFixed(1)}}</text>
						<text class="ml10">已售{{item.salesVolume}}</text>
					</view>
					<view class="card-price">
						<text class="price-symbol cyellow f24">￥</text>
						<text class="price-value cyellow f32 bold">{{item.price}}</text>
						<text v-if="item.conpTag" class="price-discount f24 c999 ml10">{{ item.conpTag }}</text>
					</view>
				</view>
			</view>
			<view class="card-shop f24 c999" @tap="handleGoShop(item)">
				<text class="store-name">{{ item.provider.provName }}</text>
				<text class="goShop">进店</text>
			</view>
		</view>
	</view>
</template>

<script>
	import {} from '@/common/api.js'
	export default {
		name: '',
		props: {
			dataArray: {
				type: Array,
				default: []
			}
		},
		data() {
			return {

			}
		},
		onLoad(option) {

		},
		methods: {
			handleGoShop(item) {
				uni.navigateTo({
					url: `/subpage/housekeeping/storeDetail?id=${item.provider.id}`
				})
			}
		}
	}
</script>

<style lang="scss">
	.goods-container {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
	}

	.goods-card {
		display: flex;
		flex-direction: column;
		width: 48%;
		overflow: hidden;
		border-radius: 40rpx;
		box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
	}

	.card-image {
		flex: 0 0 300rpx;
		width: 100%;
		height: 300rpx;
		position: relative;
		overflow: hidden;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.card-content {
		flex: auto;
		padding: 20rpx 20rpx 0 20rpx;
		background-color: #fff;
	}

	.card-title {
		line-height: 1.4;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.card-rating {
		align-items: center;
	}

	.card-price {
		display: flex;
		align-items: baseline;

		.price-symbol {
			line-height: 1;
		}

		.price-value {
			line-height: 1;
		}

		.price-discount {
			font-weight: 400;
			font-size: 24rpx;
			color: #21B9AD;
			line-height: 18px;
			text-align: left;
			font-style: normal;
		}
	}

	.card-shop {
		display: flex;
		color: #999;
		font-size: 24rpx;
		padding: 16rpx 20rpx 20rpx 20rpx;
		box-sizing: border-box;
		justify-content: space-between;
		background: #fff;

		.store-name {
			width: 190rpx;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.goShop {
			position: relative;
			padding-right: 32rpx;
			font-weight: 400;
			font-size: 12px;
			color: #34314F;
			line-height: 16px;
			text-align: center;
			font-style: normal;

			&::after {
				position: absolute;
				top: 50%;
				right: 0;
				display: block;
				width: 32rpx;
				height: 32rpx;
				transform: translateY(-50%);
				background: url('@/static/images/index/right-arrow.png') no-repeat center;
				background-size: 100% 100%;
				content: '';
			}
		}
	}
</style>